package com.xbongbong.pro.model.impl;

import com.xbongbong.pro.domain.dao.SysLabelDao;
import com.xbongbong.pro.domain.entity.SysLabelEntity;
import com.xbongbong.pro.model.SysLabelModel;
import com.xbongbong.saas.constant.ParameterConstant;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 */
@Service("sysLabelModel")
public class SysLabelModelImpl implements SysLabelModel {
    @Resource
    private SysLabelDao sysLabelDao;

    @Override
    public Long insert(SysLabelEntity entity) {
        return sysLabelDao.insert(entity);
    }

    @Override
    public void insertBatch(List<SysLabelEntity> list) {
        sysLabelDao.insertBatch(list);
    }

    @Override
    public List<SysLabelEntity> findEntities(Map<String, Object> param) {
        return sysLabelDao.findEntities(param);
    }

    @Override
    public Integer getEntityCount(Map<String, Object> param) {
        return sysLabelDao.getEntitiesCount(param);
    }

    @Override
    public void update(SysLabelEntity entity) {
        sysLabelDao.update(entity);
    }

    @Override
    public SysLabelEntity getByKey(Long key, String corpid) {
        return sysLabelDao.getByKey(key, corpid);
    }

    @Override
    public List<SysLabelEntity> getByLabelIdIn(String corpid, Collection<Long> labelIdIn) {
        Map<String, Object> param = new HashMap<>();
        param.put(ParameterConstant.CORPID, corpid);
        param.put("idIn", labelIdIn);
        return sysLabelDao.findEntities(param);
    }

    @Override
    public Integer updateBatch(List<SysLabelEntity> sysLabelEntities, String corpid) {
        return sysLabelDao.updateBatch(sysLabelEntities, corpid);
    }

}
